package com.android.fragmentdemo.definervlayoutmanager
import android.content.Context
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.hengfoxwolf.commonbase.base.util.LogX

class DefineLinearLayoutManager(context: Context) : LinearLayoutManager(context) {

    private var moveUp = false

    override fun scrollVerticallyBy(
        dy: Int,
        recycler: RecyclerView.Recycler?,
        state: RecyclerView.State?
    ): Int {
        moveUp = dy > 0
        LogX.d(TAG, "dy:$dy")
        return super.scrollVerticallyBy(dy, recycler, state)
    }

    fun actionMoveUp() = moveUp

    companion object {
        const val TAG = "DefineLinearLayoutManager"
    }
}